﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Recon.Portal.WebUI
{
    public partial class CalendarControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (IsPostBack) 
            { 
                if (TextBox1.Text == "")
                
                    Calendar1.Style["DISPLAY"] = "block";
                //divCalendar.Style["display"] = “block”;
                else
                    Calendar1.Style["DISPLAY"] = "none";
               // dateField.Style["display"] = “none”;
            } 
            
           
        }

        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            TextBox1.Text = Calendar1.SelectedDate.ToShortDateString();

            System.Web.UI.Control div = Page.FindControl("divCalendar");

            //if (typeof(div).Equals(System.Web.UI.HtmlControls.HtmlGenericControl))
            //{ 
            //    (System.Web.UI.HtmlControls.HtmlGenericControl)div. .Style.Add("display", "none")
            //}

            //If TypeOf div Is HtmlGenericControl Then    CType(div, HtmlGenericControl).Style.Add("display", "none")  End If
        }

        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            if (e.Day.IsWeekend)
            {
                e.Cell.BackColor = System.Drawing.Color.Green;
                e.Cell.ForeColor = System.Drawing.Color.Yellow;
                e.Day.IsSelectable = false;
            }
        }
                
    }
}